package com.gxa.controller;

import com.gxa.common.ResponseData;
import com.gxa.pojo.Announcement;
import com.gxa.pojo.Headquarters;
import com.gxa.pojo.Ioo;
import com.gxa.service.ConsoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: zrf.
 * Date: 2020/10/26 21:51
 * Description:控制台
 * Version: V1.0
 */
@Controller
@RequestMapping("/console")
@Api(value = "控制台",tags = "控制台接口API")
public class ConsoleController {

    @Autowired
    ConsoleService consoleService;
    @Autowired
    private ResponseData responseData;

    @RequestMapping(value = "/queryAnn",method = RequestMethod.POST)
    @ApiOperation(value = "查询已经发布信息",notes = "查询已经发布公告",httpMethod = "Post", response = ResponseData.class)
    @ResponseBody
    public ResponseData selAnn(){
        List<Map> mapList = consoleService.queryAnn();
        if(mapList != null){
            responseData.setData(mapList);
            responseData.setCode(200);
            responseData.setMsg("成功");
        }else{
            responseData.setCode(400);
            responseData.setMsg("失败");
            responseData.setData(null);
        }
        return responseData;
    }
    @RequestMapping(value = "/querytodo",method = RequestMethod.GET)
    @ApiOperation(value = "查询代办事项",notes = "查询所有为审批事项",httpMethod = "get", response = ResponseData.class)
    @ResponseBody
    public ResponseData selTodo(){
        List<Ioo> ioo = consoleService.queryAll();
        if(ioo != null){
            responseData.setMsg("成功");
            responseData.setCode(200);
            responseData.setData(ioo);
        }else{
            responseData.setMsg("失败");
            responseData.setCode(400);
            responseData.setData(null);
        }
        return responseData;
    }
}
